
package atm.components;

import atm.model.CreditCardInfo;
import atm.model.CreditCardVerificationStatus;
import atm.model.PinCodeVerificationStatus;

/**
 * Interface to bank.
 */
public interface Bank {

	/**
	 * Verifies connection with bank.
	 * 
	 * @return true if connection is OK
	 */
	boolean verifyConnection();

	/**
	 * Verifies credit card with bank.
	 * 
	 * @param creditCardInfo
	 *            Credit card information to check
	 * @return reutrns OK if card was verified successfully, INVALID if card is corrupted or BLOCKED in case card was blocked
	 */
	CreditCardVerificationStatus verifyCreditCard(CreditCardInfo creditCardInfo);

	/**
	 * Verifies the PIN code for card in current transaction.
	 * 
	 * @param pinCode
	 *            PIN code to verify
	 * @return OK if PIN was correct or FAILED_CARD_LOCKED if wrong PIN was entered too many times
	 */
	PinCodeVerificationStatus verifyPinCode(String creditCardNumber, String pinCode);

	/**
	 * Withdraws given amount from credit card's account.
	 * 
	 * @param creditCardNumber
	 *            Credit card number
	 * @param pinCode
	 *            Valid PIN code
	 * @param amount
	 *            Amount to withdraw
	 * @return true if amount was withdrawn, false in other cases
	 */
	boolean withdrawAmount(String creditCardNumber, String pinCode, int amount);
}
